package com.shujia.utils;

import java.util.HashMap;

public class HelloFriend {
    public static void main(String[] args) {
        //声明一个数组
        HashMap<Integer, String> friendMap = new HashMap<>();
        //随机生成100个数字
        for (int i = 100; i <= 200; i++) {
            //首先将信息存放到Map
            friendMap.put(i, "");
            //好友QQ号码
            for (int j = 1; j <= 4; j++) {
                int friend = (int) (Math.random() * 21 + 200 + 20 * j);
                //将好友信息存放到Map
                if (!friendMap.containsKey(friend)) {
                    friendMap.put(friend, "");
                }
                //将信息存放到Map
                friendMap.put(i, friendMap.get(i) + " " + friend);
                friendMap.put(friend, friendMap.get(friend) + " " + i);

            }
            //遍历Map
            for (Integer key : friendMap.keySet()) {
                System.out.println(key + "-----" + friendMap.get(key));
            }
        }
    }
}
